package com.aoxin.service.impl.course.webCourse;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.aoxin.mapper.SlfUserAppraiseMapper;
import com.aoxin.model.SlfUserAppraise;
import com.aoxin.service.inter.course.webCourse.UserAppraiseService;
import com.aoxin.util.EmptyUtil;

@Service
public class UserAppraiseServiceImpl implements UserAppraiseService {

    @Autowired
    SlfUserAppraiseMapper slfUserAppraiseMapper;

    @Override
    @Transactional
    public Integer deleteByAppraiseId(Integer userAppraiseId) {
        Integer result = 0;
        if(userAppraiseId != null){
            result = slfUserAppraiseMapper.deleteByAppraiseId(userAppraiseId);
        }
        return result;
    }

    @Override
    @Transactional
    public Integer deleteUserAppraise(List<Integer> userAppraiseIds) {
        Integer result = 0;
        if(userAppraiseIds != null && userAppraiseIds.size() > 0){
            result = slfUserAppraiseMapper.deleteUserAppraise(userAppraiseIds);
        }
        return result;
    }

    @Override
    @Transactional
    public Integer insertUserAppraise(SlfUserAppraise slfUserAppraise) throws IllegalAccessException {
        Integer result = 0;
        if(!EmptyUtil.objFieldsIsEmpty(slfUserAppraise)){
            result = slfUserAppraiseMapper.insertUserAppraise(slfUserAppraise);
        }
        return result;
    }

    @Override
    public List<SlfUserAppraise> getUserAppraise(SlfUserAppraise slfUserAppraise) {
        List<SlfUserAppraise> slfMakeupCoursePageInfo = slfUserAppraiseMapper.getUserAppraise(slfUserAppraise);
        return slfMakeupCoursePageInfo;
    }

    @Override
    @Transactional
    public Integer updateUserAppraise(SlfUserAppraise slfUserAppraise) throws IllegalAccessException {
        Integer result = 0;
        if(!EmptyUtil.objFieldsIsEmpty(slfUserAppraise)){
            result = slfUserAppraiseMapper.updateUserAppraise(slfUserAppraise);
        }
        return result;
    }
}
